home *** CD-ROM | disk | FTP | other *** search
- Path: gryphon.phoenix.net!usenet
- From: brucew@phoenix.net (Bruce Wedding)
- Newsgroups: comp.lang.c
- Subject: Re: Pointers to structures question.
- Date: Sun, 24 Mar 1996 18:30:43 GMT
- Organization: BranPaul Systems
- Message-ID: <4j44g2$6uk@gryphon.phoenix.net>
- References: <4j2drs$q3r@dfw-ixnews3.ix.netcom.com>
- NNTP-Posting-Host: dial60.phoenix.net
- X-Newsreader: Moe's Newsreader
-
- In comp.lang.c
- ishky@ix.netcom.com(Andrew Heiz ) wrote:
-
- >I have a simple question about using pointers to structures. I am
- >imputing data into a structure using:
- >
- > gets(struct.element);
-
- The first comment is that you should use fgets() instead of
- gets()
-
- >My question is in how to reference the structure element with a
- >pointer. How do I do this?
-
-
- Provided that you have a pointer defined and pointing at the
- struct, you may use dot notation or the more preferred ->
- operator, like this:
-
- fgets( struct_ptr->element, MAX_LEN, stdin);
-
- Bruce
-
-